package com.fashionista;

import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ListView;

/**
 * A class to create the content in the wardrobe tab
 * 
 * @author Trevor Adelman, Patrick Koperwas, Tong Wu, Shayan Yassami
 * @version for cs48 group project, 3/11/2011
 */

public class WardrobeActivity extends Activity {
	private List<ClothingItems> clothingList = new ArrayList<ClothingItems>();

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setContentView(R.layout.list_wardrobe);
		setTitle("Your Current Wardrobe");

		ClothingParser wardrobeParse = new ClothingParser(); //Creates a new parsing object
		InputStream inStr = getResources().openRawResource(R.raw.clothing); //and sets the clothing.xml as the file to be used
		wardrobeParse.parse(inStr); //Parses the xml file
		List<ClothingItems> clothingList = wardrobeParse.getList(); //and sets the clothingList variable to the generated List in the ClothingParser object
		ClothingArrayAdapter newAdapter = new ClothingArrayAdapter(
				getApplicationContext(), R.layout.wardrobe_listitem,
				clothingList); //Creates a ClothingArrayAdapter with the clothingList
		ListView lv = (ListView) findViewById(R.id.wardrobeLV); //Creates a new ListView using the wardRobeLV layout
		lv.setAdapter(newAdapter); //and sets the adapter for the list lv
	}
}
